Here is (nearly) the program that will work with this type of input data file:
import java.io.*;
class AddUpAllSentinel
{
public static void main ( String[] args ) throws IOException
{
int value; // the value of the current integer
int sum = _____; // initialize sum
String line;
BufferedReader stdin = new BufferedReader(
new InputStreamReader( System.in ) );
// get first integer
System.out.println("Enter first integer:");
line = stdin.readLine();
value = Integer.parseInt( line.trim() );
int count = _______; // initialize count
while ( value >= ________ )
{
sum = _____________; // add to the sum
count = _____________; // increment count
System.out.println("Enter a number:");
line = stdin.readLine();
value = Integer.parseInt( line.trim() );
}
System.out.println( "Grand Total: " + sum );
}
}
The program includes user prompts so that it is easy to debug with keyboard input. A "production" version of the program would change those lines into comments.